//编写函数，计算某月某日是该年度的第几天。
#include <stdio.h>

const int M[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int main()
{
    int f;
    int year,month,day;
    printf("Default year - 1\nChoose a year - 0\n->");
    scanf("%d",&f);
    if(f)
        printf("It is 2016.\n"), year=2016;
    else
        printf("Year(>=0): "), scanf("%d",&year);
    printf("Month(1-12): ");
    scanf("%d",&month);
    printf("Day(1-28/29/30/31): ");
    scanf("%d",&day);
    int i,lunar,date;
    if(year%4==0)
        if(year%100==0)
            if(year%400==0)
                lunar=1;
            else
                lunar=0;
        else
            lunar=1;
    else
        lunar=0;
    date=0;
    for(i=1;i<month;i++)
        date+=M[i], date+=(i==2&&lunar);
    date+=day;
    printf("%d/%d/%d is the %d",month,day,year,date);
    if(date%10==1)
        printf("st");
    else if(date%10==2)
        printf("nd");
    else if(date%10==3)
        printf("rd");
    else
        printf("th");
    printf(" day of %d.\n",year);
    return 0;
}